Skip to content

Add sextend_maybe and uextend_maybe to opt ISLE#7710

Merged
fitzgen merged 2 commits into
bytecodealliance:mainfrom
scottmcm:opt-extend-maybe
Dec 20, 2023
Merged

Add sextend_maybe and uextend_maybe to opt ISLE#7710
fitzgen merged 2 commits into
bytecodealliance:mainfrom
scottmcm:opt-extend-maybe

Conversation

@scottmcm
Copy link
Copy Markdown
Contributor

Working on something else, I noticed that the (x < y) != 0 opt was written in a way that only works for C

;; Optimize icmp-of-icmp.
(rule (simplify (ne ty
(uextend _ inner @ (icmp ty _ _ _))
(iconst_u _ 0)))
(subsume inner))
(rule (simplify (eq ty
(uextend _ (icmp ty cc x y))
(iconst_u _ 0)))
(subsume (icmp ty (intcc_complement cc) x y)))

whereas in Rust, which doesn't have the "usual arithmetic conversions", the result of the comparison stays as I8 and thus without the extension it didn't match that pattern.

This picks up a suggestion that alex had made in a previous PR (#7636 (comment)) to make something like lowering ISLE's maybe_uextend extractor for optimization ISLE.

They're then used to improve the mentioned icmp-of-icmp pattern

8ef0b81#diff-fa420f878e321dc6579ac911f9ba8820a9381e4c49615584f6e6909f0e329dfcL124-R125

as well as simplify some of the duplication in the <=> patterns.

@scottmcm scottmcm requested a review from a team as a code owner December 20, 2023 01:54
@scottmcm scottmcm requested review from elliottt and removed request for a team December 20, 2023 01:54
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language labels Dec 20, 2023
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @cfallin, @fitzgen

Details This issue or pull request has been labeled: "cranelift", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@fitzgen fitzgen added this pull request to the merge queue Dec 20, 2023
Merged via the queue into bytecodealliance:main with commit 37300d3 Dec 20, 2023
@scottmcm scottmcm deleted the opt-extend-maybe branch December 20, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants